<%@language=vbscript%>
<%
	Session("FormName")="F22"
%>
<!--#include file="..\CheckSession.inc"-->
<!--#include file="..\RootContent.inc"-->
<!--#include file=..\getFormName.inc-->
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Văn bản dự thảo</title>
</head>
<%		
	Dim Msg
	bComm=Request("bComm")
'HienSX
	sort=Request("sort")

	if bComm="edit" then
		bID=Request("bID")
		sSQL="Select * from VTDuthao Where IdDuthao Like '"& bID &"'"
		Set RecT=Server.CreateObject("ADODB.Recordset")
		RecT.CursorType=3
		RecT.CacheSize=5
		RecT.Open sSQL,Conn
		Dim bDisplay
		bDisplay=False
		if RecT.RecordCount>0 then
			dim bSoghinhan
			Dim bSogoccu
			Session("bMaVBDi")=RecT("soghinhan")
			Session("bTenVBDi")=RecT("Trichyeu")
			'bSoghinhan=RecT("soghinhan")		
			'bSoghinhancu=RecT("soghinhan")			
			bID=RecT("IdDuthao")
			bTrichyeu=RecT("Trichyeu")
			bTentep=RecT("Tentep")
			bTentepcu=RecT("Tentep")
			bNgaytao=RecT("Ngaytao")
			bNguoitao=RecT("NguoiTao")
			bTukhoa=RecT("Tukhoa")
			bDisplay=true
			bThoihan=RecT("Thoihan")
			bVinhvien=RecT("Vinhvien")	
			bNam=year(RecT("Ngaytao"))		
			bNamcu=year(RecT("Ngaytao"))			
		else
			'Response.Redirect("frmdsvtduthao.asp?Chuachon=thongtin")
		end if
	end if
	Dim bTonTai
	Select case bComm
		case "okedit"
			'bSoghinhan=trim(Request("TxtSoghinhan"))
			bID=Request("bID")
			Msg="N&#7897;i dung &#273;&#227; &#273;&#432;&#7907;c s&#7917;a"
			bTonTai=false
			bComm="edit"
			bTrichyeu=trim(Request("TxtTrichyeu"))
			bTentep=trim(Request("TxtTenTep"))
			bNguoitao=Session("bMaCB")
			bNGaytao=request("TxtNgayTao")
			bTukhoa=trim(Request("TxtTukhoa"))
			'bSoghinhancu=trim(Request("bSoghinhancu"))
			bVinhvien=Request("RButton")			
			bThoihan=request("TxtThoihan")
			bNam=year(request("TxtNgayTao"))
			bNamcu=Request("bNamcu")
			if bVinhvien<>"" then
				bVinhvien=1
				bThoihan=Savedate(bThoihan)
			else
				bVinhvien=0				
			end if			
			if Request("filename")<>"" then
				bTentepcu=Request("filename")
			end if			
			bNgayTao=SaveDate(bNgayTao)
			if bVinhvien then
				sSQL="Update VTDuthao set ngaytao='"& ModiString(bNgaytao) _
					&"',Nguoitao='"& Session("bMaCB") _
					&"',Trichyeu='"& ModiString(bTrichyeu) _
					&"',Tukhoa='"& ModiString(bTukhoa) _
					&"',Thoihan='"& bThoihan _
					&"',vinhvien="& bVinhvien _
					&" Where IdDuthao like '"& bID &"'" 
			else
				sSQL="Update VTDuthao set ngaytao='"& ModiString(bNgaytao) _
					&"',Nguoitao='"& Session("bMaCB") _
					&"',Trichyeu='"& ModiString(bTrichyeu) _
					&"',Tukhoa='"& ModiString(bTukhoa) _
					&"',Thoihan=NULL,vinhvien="& bVinhvien _
					&" Where IdDuthao like '"& bID &"'" 
			end if
			Conn.Execute sSQL
			
			bOKUpdate=false
			if cstr(bNam)=cstr(bNamcu) then
				bOKUpdate=true
			end if
			if not bOKUpdate then
				'Sua File
				set TextFile=server.CreateObject("Activefile.file")
				PathOld=RootContent & "Upload\"& cstr(bNamcu) &"\Duthao\Text"
				PathOld=Pathold & "\" & bID & ".VT" 
				Path=RootContent & "Upload\"& cstr(bNam) &"\Duthao\Text"
				Path=Path & "\" & bID & ".VT" 	
				
				'Tao thu muc nam moi
				Set bDir=server.CreateObject("ActiveFile.Directory")
				bPathFolder=RootContent & "Upload"& "\" & bNam
		          bDir.Path=bPathFolder
	       		if not bDir.Exists() then
     	  		   	call bDir.Create(bPathFolder)
       			end if
       			bPathFolder=bPathFolder & "\Duthao"
				bDir.Path=bPathFolder
			     if not bDir.Exists() then
					Call bDir.Create(bPathFolder)
				end if
	    			bPathFolder=bPathFolder & "\Text"
			    	bDir.Path=bPathFolder
		    		if not bDir.Exists() then
			    		Call bDir.Create(bPathFolder)
				end if
		     	Set bDir=nothing		          
		          TextFile.Name=Path		          
				if TextFile.Exists() then
					TextFile.Delete()
				end if				
				TextFile.Name=PathOld	
				if TextFile.Exists() then
					Call TextFile.Copy (Path)				
				end if
				TextFile.Name=PathOld				
				if TextFile.Exists() then
					TextFile.Delete()
				end if				
				sSQL="Select * from vanban_noidung where mavanthu Like '"& ModiString(bID) &"' and Loaivanthu='3'  order by Sothutu"
				Set RecRename=server.CreateObject("ADODB.Recordset")
				RecRename.CursorType=3
				RecRename.CacheSize=5
				RecRename.Open sSQL,Conn
				Set Ex=server.CreateObject("Vinalines.ClsFile")				
				Do while not RecRename.EOF					
					Pathold=RootContent & "Upload\"& Cstr(bNamcu) &"\Duthao"
					Pathold=Pathold & "\" & bID & "S" & trim(cstr(RecRename("sothutu"))) & "." & Ex.GetExtensionFile(RecRename("Tentep"))			
					Path=RootContent & "Upload\"& Cstr(bNam) &"\Duthao"
					Path=Path & "\" & bID & "S" & trim(cstr(RecRename("sothutu"))) & "." & Ex.GetExtensionFile(RecRename("Tentep"))			
					TextFile.Name=Path
					if TextFile.Exists() then
						TextFile.delete()
					end if
					TextFile.Name=PathOld
					if TextFile.Exists() then
						call TextFile.Copy (Path)
						TextFile.Delete()
					end if
					bName=bID & "S" & trim(cstr(RecRename("sothutu"))) & "." & Ex.GetExtensionFile(RecRename("Tentep"))
					sSQL="Update vanban_noidung set Tentep='"& bName &"' where loaivanthu='3' and   Sothutu="& RecRename("sothutu") &" And mavanthu like '"& ModiString(bID) &"'"
					Conn.Execute sSQL
					RecRename.MoveNext
				Loop
				RecRename.Close
				set RecRename=nothing
				set TextFile=nothing
				Set Ex=nothing
			end if
			bNamcu=bNam
			'Ghi nhan Ai da login thanh cong
			bHoten=Session("bHoten")
			bNgaygio=cstr(Date()) &" "& cstr(Time())
			bChucnang="C&#7853;p nh&#7853;t V&#259;n th&#432; d&#7921; th&#7843;o"
			bIDTailieu=bSoghinhan
			bTrangthai=1
			bDongtac="Ghi nh&#7853;n S&#7917;a"
			sSQL="insert into loguser(Tennguoisudung,ngaygio,chucnangdung,dongtac,IDTailieu,Trangthai) Values('"& bHoten _
				&"','"& bNgaygio &"','"& bChucnang &"','"& bDongtac &"','"& bIDTailieu &"','"& bTrangthai &"')"
			Conn.Execute sSQL
		case "okadd"
			'bSoghinhan=trim(Request("TxtSoghinhan"))
			Msg="N&#7897;i dung c&#7853;p nh&#7853;t"
			bTonTai=false
			bComm="edit"
			'bSoghinhancu=bSoghinhan
			bTrichyeu=trim(Request("TxtTrichyeu"))
			bTentep=trim(Request("TxtTenTep"))
			bNguoitao=trim(Request("TxtNguoitao"))
			bNGaytao=request("TxtNgaytao")
			bNam=year(Request("TxtNgaytao"))
			bTukhoa=trim(Request("TxtTukhoa"))
			bTentep="DT"+cstr(year(date()))+bSoghinhan+".doc"
			bNgayTao=Savedate(bNgaytao)
			bVinhvien=Request("RButton")
			bThoihan=request("TxtThoihan")
			bNamcu=bNam
			if bVinhvien<>"" then
				bvinhvien=1
				bThoihan=savedate(bThoihan)
			else
				bVinhvien=0				
			end if			
			if bVinhvien then			
				sSQL="Insert Into VTDuthao(soghinhan,trichyeu,tentep,nguoitao,ngaytao,tukhoa,Thoihan,Vinhvien) values('"& modistring(bSoghinhan) _
						&"','"& ModiString(bTrichyeu) _
						&"','"& ModiString(bTentep) &"','"& Session("bMaCB") _
						&"','"& ModiString(bNgaytao) &"','"& ModiString(bTukhoa) _
						&"','"& bThoihan &"',"& bVinhvien &")"
			else
				sSQL="Insert Into VTDuthao(soghinhan,trichyeu,tentep,nguoitao,ngaytao,tukhoa,Vinhvien,Thoihan) values('"& modistring(bSoghinhan) _
						&"','"& ModiString(bTrichyeu) _
						&"','"& ModiString(bTentep) &"','"& Session("bMaCB") _
						&"','"& ModiString(bNgaytao) &"','"& ModiString(bTukhoa) _
						&"',"& bVinhvien &",NULL)"
			end if
			Conn.Execute sSQL
			
			'Ghi nhan Ai da login thanh cong
			bHoten=Session("bHoten")
			bNgaygio=cstr(Date()) &" "& cstr(Time())
			bChucnang="C&#7853;p nh&#7853;t V&#259;n th&#432; d&#7921; th&#7843;o"
			bIDTailieu=bSoghinhan
			bTrangthai=1
			bDongtac="Th&#234;m m&#7899;i"
			sSQL="insert into loguser(Tennguoisudung,ngaygio,chucnangdung,dongtac,IDTailieu,Trangthai) Values('"& bHoten _
				&"','"& bNgaygio &"','"& bChucnang &"','"& bDongtac &"','"& bIDTailieu &"','"& bTrangthai &"')"
			Conn.Execute sSQL
			
			'Lay ID
			sSQL="select max(idduthao) as IDDuthao from VTDuthao"
			Set recID=server.CreateObject("ADODB.Recordset")
			RecID.CursorType=3
			RecID.CacheSize=5
			RecID.Open sSQL,conn
			bID=RecID("IDDuthao")
			if Session("VanBan")="" then 
				Session("VanBan")="-" & Session("VanBan") & bID &"-"
			else
				Session("VanBan")=Session("VanBan") & bID &"-"
			end if
			RecID.Close
			Set RecID=nothing
	end select	
%>	
<%if Msg<>"" then%>
	<p align=center><font face=Arial color=red><%=Msg%></font></p>
<%end if%>	
<!--#include file="..\jvfunction.inc"-->
<script language=vbscript runat=server>
	Function SaveDate(vDate)
		dim bvitri1
		dim bvitri2
	   vDate=trim(cstr(vDate))
	   bvitri1=instr(1,vDate,"/")
	   bMonth=left(vDate,bvitri1-1)
	   bvitri2=instr(bvitri1+1,vDate,"/")
	   Dim Temp
	   Temp=right(vDate,len(vDate)-bvitri1)
	   bDay=left(Temp,bvitri2-bvitri1-1)
	   bYear=right(vDate,len(vDate)-bvitri2)
       SaveDate=bDay+"/"+bMonth+"/"+bYear
	End Function
	' H&#224;m &#273;&#7883;nh d&#7841;ng l&#7841;i ng&#224;y M/D/Y-> D/M/Y		
	Function FormatDate(vDate)
	   If Not IsNull(vDate) Then
	        vM = Right("0" & Month(vDate), 2)
	        vD = Right("0" & Day(vDate), 2)
	        vY = Right("19" & Year(vDate), 4)
	        FormatDate = vD & "/" & vM & "/" & vY
	   End If
	End Function
	Function ModiString(mess_s)
		message = Replace("" & mess_s,"'", "''")
		ModiString=message
	End function
	'Kiem tra so ghi nhan
	Function KTSoghinhan(bValue,loai)
		KTSoghinhan=false
		if loai="okedit" then
			bSoghinhancu=request("bSoghinhancu")
			if bValue<>bSoghinhancu then
				sSQL="Select Soghinhan from Vtduthao where Soghinhan like '"& Modistring(bValue) &"'"
				set RecKT=server.CreateObject("ADODB.Recordset")
				RecKT.CursorType=3
				RecKT.CacheSize=5
				RecKT.Open sSQL,Conn
				if (not RecKT.BOF) and (not RecKT.EOF) then
					KTSoghinhan=true
				end if
				RecKT.Close
				set RecKT=nothing				
			end if
		end if
		if loai="okadd" then
			sSQL="Select Soghinhan from Vtduthao where Soghinhan like '"& Modistring(bValue) &"'"
			set RecKT=server.CreateObject("ADODB.Recordset")
			RecKT.CursorType=3
			RecKT.CacheSize=5
			RecKT.Open sSQL,Conn
			if (not RecKT.BOF) and (not RecKT.EOF) then
				KTSoghinhan=true
			end if
			RecKT.Close
			set RecKT=nothing				
		end if			
	End function
</script>	
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function RButton_click() {
	if(Noidung.RButton.checked){
		Noidung.TxtThoihan.value="<%=formatdate(Date()+180)%>"
	}
	else{
		Noidung.TxtThoihan.value="";
	}
}
function CmdExit_onclick() {
	window.Noidung.target="right"
	window.Noidung.action="frmdsvtduthao.asp?&sort="+Noidung.Sort.value;
	window.Noidung.submit();
}

function CmdCancel_onclick() {
//	window.navigate("frmvtden.htm")
}

function CmdAdd_onclick() {
	window.Noidung.target="right";
	window.Noidung.action="frmvtduthao.asp?bComm=add";
	window.Noidung.submit();
}
function KTNhap(){
	/*if (trim(Noidung.TxtSoghinhan.value)==""){
		alert("Bạn cần phải nhập số ghi nhận");
		Noidung.TxtSoghinhan.focus();
		return false;
	}
	if(daucach(Noidung.TxtSoghinhan.value)){
		alert("Số ghi nhận không cho phép chứa ký tự đặc biệt(',space)");
		Noidung.TxtSoghinhan.focus();
		return false;
	}*/
	if (trim(Noidung.TxtTrichyeu.value)==""){
		alert("Cho biết trích yếu nội dung");
		Noidung.TxtTrichyeu.focus();
		return false;
	}
	if (!isDate(Noidung.TxtNgaytao.value)){
		alert("Ngày tạo không hợp lệ");
		Noidung.TxtNgaytao.focus();
		return false;
	}	
	if (Noidung.RButton.checked){
		if(trim(Noidung.TxtThoihan.value)=="" || !isDate(Noidung.TxtThoihan.value)){
			alert("Ngày không hợp lệ");
			Noidung.TxtThoihan.focus();	
			return false;
		}		
	}	
	return true;
}
function CmdOK_onclick() {
	if (KTNhap()){
		<%if bComm="edit" then%>
			window.Noidung.target="right";
			window.Noidung.action="frmVTDuThao.asp?bComm=okedit"+"&bNamcu="+"<%=bNamcu%>";
			window.Noidung.submit();
		<%end if%>		
		<%if bComm="add" then%>
			window.Noidung.target="right";
			window.Noidung.action="frmVTDuthao.asp?bComm=okadd"+"&bNamcu="+"<%=bNamcu%>";
			window.Noidung.submit();
		<%end if%>
	}
}
function CmdXemNoidung_onclick(){
	<%if bComm="add" then %>
		alert("Bạn cần phải ghi nhận văn thư trước");
		return false;
	<%end if%>
	<% if bComm="edit" then%>
		bMa=Noidung.bID.value;
		a="../editor/frmedit.asp?bMa="+bMa+"&bLoaiVT=3"+"&bNam="+"<%=bNam%>"+ "&sort="+Noidung.Sort.value;
		window.Noidung.action=a;
		window.Noidung.target="right";
		window.Noidung.submit();
	<%end if%>
}
function CmdNoidungtep_onclick() {
	<%if bComm="add" then %>
		alert("Bạn cần phải ghi nhận văn thư trước");
		return false;
	<%end if%>
	//if (Noidung.TxtSoghinhan.value!=""){
		window.Noidung.target="_blank";
		bMa=Noidung.bID.value;
		window.Noidung.action="xemnoidung.asp?LoaiVt=3&bMA="+bMa+"&bNam="+"<%=bNam%>";
		window.Noidung.submit();
	//}	
}
function CmdEmail_onclick() {
	Noidung.target="_blank";
	Noidung.TxtTrichyeu.disabled=false;
	bMa=Noidung.bID.value;
	Noidung.action="compose.asp?bLoaiVt=3&bMa="+bMa+"&bNam="+"<%=bNam%>";
	Noidung.submit();
}
function CmdWorkflow_onclick() {
	if (Noidung.bID.value==""){
		alert("Bạn hãy chọn văn thư cần xử lý");
		return false;
	}
	if(!confirm("Bạn có thực sự tạo luồng xử lý không ?")){
	  return false;
	}
	window.Noidung.target="right";	
	window.Noidung.action="../workflow/createworkflow.asp?bComm=vtduthao";
	window.Noidung.submit();	
}
function TxtNgaytao_onkeyup(str){
var keycode
keycode=window.event.keyCode
if (isEdit(keycode,str)){
	Noidung.TxtNgaytao.value=editdate(trim(str))
}
}
function TxtThoihan_onkeyup(str){
var keycode
keycode=window.event.keyCode
if (isEdit(keycode,str)){
	Noidung.TxtThoihan.value=editdate(trim(str))
}
}
//-->
</SCRIPT>
<body topmargin="0" leftmargin="0" bgcolor="#F8F9D9" style="font-family:times new roman">
<form name=Noidung method=post>
<Input TYPE="hidden" name="Sort" value="<%=sort%>">
<%if bComm="edit" then%>
	<input type=hidden name=bID value='<%=bID%>'>
<%else%>
	<input type=hidden name=bID value='<%=bID%>'>
<%end if%>
<table border="0" cellspacing="0" style="font-size:12pt;BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0" width="100%" bordercolor="#111111" bgcolor="#BDD5D0">
  <tr>
    <td width="100%" colspan="4" bgcolor="#000080" >
    <p align="center"><font color="#FFFFFF" style="font-size: 11pt"><b>VĂN BẢN CÁ NHÂN</b></font></td>
  </tr>  
  <!-- bg thphuc 19-02-2003 -->
  <!-- <tr>
    <td width="15%">Số đăng ký</td>
	<td width="85%" colspan="3" >
	<%if bDisplay then%>
		<input name='TxtSoghinhan' value='<%=bSoghinhan %>' size=82 maxlength=20 style='font-family:Arial;width:100%'></td>
	<%else
		if bComm<>"add" then%>
			<input name='TxtSoghinhan' value='<%=bSoghinhan %>' size=82 maxlength=20 style='font-family:Arial;width:100%'></td>
		<%else%>
			<input name='TxtSoghinhan' size=82 maxlength=20 style='font-family:Arial;width:100%'></td>
		<%end if
	end if%>    
  </tr>   -->
	<!-- ed thphuc 19-02-2003 -->
  <tr>
    <td width="15%" >Trích yếu</td>
	<td width="85%" colspan="3" >
	<%if bDisplay then%>
		<textarea name=TxtTrichyeu maxLength=255 style='font-family:Arial;width:100%' rows=1 cols=82><%= bTrichyeu %></textarea></td>
	<%else
		if bComm<>"add" then%>
			<textarea name=TxtTrichyeu maxLength=255 style='font-family:Arial;width:100%' rows=1 cols=82><%=bTrichyeu %></textarea></td>
		<%else%>
			<textarea name=TxtTrichyeu maxLength=255 style='font-family:Arial;width:100%' rows=1 cols=82></textarea></td>
		<%end if
	end if%>    
  </tr>
  <tr>
    <td width="15%" >Ngày tạo</td>
	<td width="20%">
	<%if bDisplay then%>
			<input name=TxtNgaytao value='<%= formatdate(bNgayTao) %>' size=15 maxLength=10 style='font-family:Arial;width:100%' LANGUAGE=javascript onkeyup="return TxtNgaytao_onkeyup(this.value)"></td>
	<%else
			if bComm<>"add" then%>
				<input name=TxtNgaytao value='<%= formatdate(bNgayTao) %>' size=15 maxLength=10 style='font-family:Arial;width:100%' LANGUAGE=javascript onkeyup="return TxtNgaytao_onkeyup(this.value)"></td>
			<%else%>
				<input name=TxtNgaytao value='<%= formatdate(Date()) %>' size=15 maxLength=10 style='font-family:Arial;width:100%' LANGUAGE=javascript onkeyup="return TxtNgaytao_onkeyup(this.value)"></td>
			<%end if
	end if%>    
    <td width="15%" align="center">Người tạo</td>
    <td width="50%"><input name=TxtNguoitao value='<%=session("bHoten")%>' size=44 readOnly style='font-family:Arial;width:100%'></td>
  </tr>
  <tr>
    <td width="15%" >Từ khóa</td>
	<td width="85%" colspan="3" >
	<%if bDisplay then%>
		<input name=TxtTukhoa value='<%= bTukhoa %>' size=82 maxLength=100 style='font-family:Arial;width:100%'></td>
	<%else	
		if bComm<>"add" then%>
			<input name=TxtTukhoa value='<%= bTukhoa %>' size=82 maxLength=100 style='font-family:Arial;width:100%'></td>
		<%else%>
			<input name=TxtTukhoa size=82 maxLength=100 style='font-family:Arial;width:100%'></td>
		<%end if
	end if%>    
  </tr>
  <tr>
    <td width="15%" ><label for=C1>Thời hạn xóa</label></td>
    <%if bDisplay then
		if bVinhvien then%>
			<td width="85%" colspan="3">
    			<input name=RButton checked type=checkbox LANGUAGE='javascript' onclick='return RButton_click()' value="ON" id=C1>
				<input type=text name=TxtThoihan value="<%= formatdate(bThoihan) %>" size=15 maxLength=10  LANGUAGE=javascript onkeyup="return TxtThoihan_onkeyup(this.value)">
		    </td>
		<%else%>
			<td width="85%" colspan="3">
   				<input name=RButton type=checkbox LANGUAGE='javascript' onclick='return RButton_click()' value="ON" id=C1>
				<input type=text name=TxtThoihan size=15 maxLength=10 LANGUAGE=javascript onkeyup="return TxtThoihan_onkeyup(this.value)">
		    </td>
		<%end if							
	else	
		if bComm<>"add" then	
			if bVinhvien then%>
				<td width="85%" colspan=3> 
    				<input name=RButton checked type=checkbox LANGUAGE='javascript' onclick='return RButton_click()' value="ON" id=C1>
					<input type=text name=TxtThoihan value="<%= formatdate(bThoihan) %>" size=15 maxLength=10 LANGUAGE=javascript onkeyup="return TxtThoihan_onkeyup(this.value)">
			    </td>
			<%else%>
				<td width="85%" colspan=3>
   					<input name=RButton type=checkbox LANGUAGE='javascript' onclick='return RButton_click()' value="ON" id=C1>
					<input type=text name=TxtThoihan size=15 maxLength=10 LANGUAGE=javascript onkeyup="return TxtThoihan_onkeyup(this.value)">
			    </td>
			<%end if								
		else%>
			<td width="85%" colspan=3>
   				<input name=RButton type=checkbox LANGUAGE='javascript' onclick='return RButton_click()' value="ON" id=C1>
				<input type=text name=TxtThoihan size=15 maxLength=10 LANGUAGE=javascript onkeyup="return TxtThoihan_onkeyup(this.value)">
		    </td>
		<%end if
	end if%>        
  </tr>  
</table>
<table border="0" cellpadding="0" cellspacing="0" style="BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0" width="100%" bgcolor="#BDD5D0" bordercolor="#111111">
  <tr>
    <td width="14%"><Button name="CmdAdd" style="font-family: Arial; height: 25; position: relative; width: 100%" LANGUAGE="javascript" onclick="return CmdAdd_onclick()" accesskey="T"><u>T</u>hêm</Button></td>
    <td width="14%" ><Button name="CmdOK" style="font-family: Arial; height: 25; position: relative; width: 100%" LANGUAGE="javascript" onclick="return CmdOK_onclick()" accesskey="G"><p><u>G</u>hi nhận</p></Button></td>
    <%if bComm="add" then%>
		<td width="15%"><Button disabled name="CmdXemNoidung1" style="font-family: Arial; height: 25; position: relative; width: 100%" LANGUAGE="javascript" onclick="CmdXemNoidung_onclick()" accesskey="S"><p><u>S</u>oạn nội dung</p></Button></td>
		<td width="15%"><Button disabled name="CmdNoidungtep1" style="font-family: Arial; height: 25; position: relative; width: 100%" LANGUAGE="javascript" onclick="CmdNoidungtep_onclick()" accesskey="X"><p><u>X</u>em nội dung</p></Button></td>
		<td width="17%"><Button name="CmdWorkflow" style="font-family: Arial; height: 25; position: relative; width: 100%" LANGUAGE="javascript" disabled onclick="CmdWorkflow_onclick()" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button></td>
		<td width="15%" ><Button name="CmdEmail" style="font-family: Arial; height: 25; position: relative; width: 100%" LANGUAGE="javascript" disabled onclick="CmdEmail_onclick()" accesskey="E"><u>E</u>mail</Button></td>
   <%else%>
		<td width="15%"><Button name="CmdXemNoidung1" style="font-family: Arial; height: 25; position: relative;width:100%" LANGUAGE="javascript" onclick="CmdXemNoidung_onclick()" accesskey="S"><p><u>S</u>oạn nội dung</p></Button></td>
		 <td width="15%"><Button name="CmdNoidungtep1" style="font-family: Arial; height: 25; position: relative;width:100%" LANGUAGE="javascript" onclick="CmdNoidungtep_onclick()" accesskey="X"><p><u>X</u>em nội dung</p></Button></td>
		<%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin") then%>
			 <td width="17%"><Button name="CmdWorkflow" style="font-family: Arial; height: 25; position: relative; width: 100%" LANGUAGE="javascript"  onclick="CmdWorkflow_onclick()" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button></td>
		<%else%>
			 <td width="17%"><Button disabled name="CmdWorkflow" style="font-family: Arial; height: 25; position: relative; width: 100%" LANGUAGE="javascript"  onclick="CmdWorkflow_onclick()" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button></td>
		<%end if%>
		 <td width="15%" ><Button name="CmdEmail" style="font-family: Arial; height: 25; position: relative; width: 100%" LANGUAGE="javascript"  onclick="CmdEmail_onclick()" accesskey="E"><u>E</u>mail</Button></td>
  <%end if%>     
	<td width="10%"><Button name="CmdExit" style="font-family: Arial; height: 25; position: relative; width: 100%" LANGUAGE="javascript" onclick="return CmdExit_onclick()" accesskey="Y"><p>Qua<u>y</u> lại</p></Button></td>
  </tr>
</table>
</form>
</body>
</html>
<%
	Conn.Close
	set Conn=nothing
%>